package name.bingo.bing.concurrent.red.packet.dao;

import name.bingo.bing.concurrent.red.packet.model.TRedPacket;
import name.bingo.common.sql.dao.MyBatisDao;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * @author [ your email ]
 * @date 2019-03-22 11:09:52
 * Created by CodeGen .
 */
@Repository
public class TRedPacketDao extends MyBatisDao<TRedPacket> {

    /**
     * 红包库存减一
     * */
    public Boolean decreaseRedPacket(Long redPacketId,Long version){
        Map<String, Object> mapParam = new HashMap<>(3);
        mapParam.put("id", redPacketId);
        mapParam.put("version", version);
        return getSqlSession().update(sqlId("decreaseRedPackets"), mapParam) == 1;
    }

}
